const path = require("path");
const { merge } = require("webpack-merge");
const baseConfig = require("./webpack.config");
const webpackCommonRules = require("./webpack.rules.common");

const proConfig = merge(baseConfig, {
  mode: "product",
  optimization: {
    moduleIds: 'deterministic', // 保证hash的确定性，希望打包后的vendor文件hash是唯一的
    runtimeChunk: "single", // 减少重复代码
    splitChunks: {
      cacheGroups: {
        vendor: {
          test: /[\\/]node_modules[\\/]/,
          name: "vendors",
          chunks: "all",
        },
      },
    },
  },
});

module.exports = proConfig;
